Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by petur · Apr 27, 2017 at 12:48 PM · android buildpluginjavastartupmanifest

How to launch unity android app on startup?

I have seen similar questions but I can't get it working, either because I lack some basic knowledge or because I am missing in between steps.

I have also checked the plug in build manual and found no answer, it exposes several methods to execute native code, using DLLs, using "androidJavaObjects" created in c# scripts and using java classes. This third method seemed the simpler so I went with it. This is what I have done:

-Create in the Plugins folder and Android folder, placed this AndroidManifest.xml there: http://schemas.android.com/apk/res/android">

   <uses-permission android:name="com.test.app.permission.C2D_MESSAGE" />
   <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
   <uses-permission android:name="android.permission.WAKE_LOCK" />
 
   <application android:label="@string/app_name">
     <receiver android:name="ReceiverOnBoot" android:enabled="true"
        android:exported="true" android:label="com.InteractionFactory.startingtest.ReceiverOnBoot">
           <intent-filter>
               <action android:name="android.intent.action.REBOOT" />
           </intent-filter>
           <intent-filter>
               <action android:name="android.intent.action.BOOT_COMPLETED" />
           </intent-filter>
     </receiver>
  
 
   </application>
 </manifest>

-Create an "ReceiverOnBoot.java" file with those contents pakage com.InteractionFactory.startingtest;

 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 
 public class ReceiverOnBoot extends BroadcastReceiver {
 
     @Override
     public void onReceive(Context context, Intent intent)
     {        
         intent = new Intent(Intent.ACTION_VIEW);
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         intent.setData(Uri.parse("market://details?id="+packageName));
         startActivity(intent);
     }
  }

I have tried replacing the "onReceive" function contents with "Toast.makeText(context, "TEXT TO DISPLAY", Toast.LENGTH_LONG).show();" for debug purposes, to no effect.

Also, since I added those files no icon is created when I install the apk.

Do I need to compile the "java" file in any way? Build "jar" files maybe?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bonfire-Boy · Jan 17, 2018 at 12:44 PM 0
Share

This doesn't seem like a Unity question to me. I think you might find more help if you asked elsewhere.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by myworkema · Jan 17, 2018 at 12:00 PM

Have you reslove this probleme ?? i have the same ??

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by petur · Jan 17, 2018 at 12:25 PM

No, I ended up using 3rd party software to launch my app.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

UnityPlayerActivity vs. UnityPlayerNativeActivity 0 Answers

How to write a java lib for unity as a plugin to make run another android app? 1 Answer

Android build failes because of manifest 0 Answers

How can I set/get/confirm the API used for an embedded Android script? 0 Answers

How to extend UnityPlayerActivity 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges