java - Start Flex Mobile Application on Android startup -


i having issue start application on android startup, problem how put listeners on "android.permission.receive_boot_completed" manifest ( on mobile application project flash builder) native extension ??

basically on manifest have :

<uses-permission android:name="android.permission.receive_boot_completed" />     <application>        <receiver android:enabled="true" android:name="extension_package.application.receivers.applicationstartupreceiver" android:permission="android.permission.receive_boot_completed">         <intent-filter>             <action android:name="android.intent.action.boot_completed" />             <category android:name="android.intent.category.default" />         </intent-filter>        </receiver>     </application> 

and on native side : listener should :

package extension_package;  import android.content.broadcastreceiver; import android.content.context; import android.content.intent;  import com.adobe.fre.frecontext; import com.adobe.fre.frefunction; import com.adobe.fre.freobject;  public class applicationstartupreceiver extends broadcastreceiver implements frefunction {       @override         public void onreceive(context context, intent intent) {             if ("android.intent.action.boot_completed".equals(intent.getaction())) {                 intent serviceintent = new intent("com.myapp.mysystemservice");                 context.startservice(serviceintent);             }         }      @override     public freobject call(frecontext arg0, freobject[] arg1) {         // todo auto-generated method stub         return null;     } } 

my questions :

  • the "extension_package" package name native project or extension id ?
  • the ".application" refers application or don't need ?

i hope understand situation , thank in advance.

-----------------------------------------edit----------------------------------------

after few attempts , tests, have changed these values :

<receiver android:enabled="true" android:name="nativeprojectpackage.application.receiver.applicationstartupreceiver" android:permission="android.permission.receive_boot_completed"> 

and :

intent serviceintent = new intent("air.application_id"); // application.xml 

and seems work, problem now, crashes on android startup, recieve alert saying : "unfortunately application 'application name' has stopped" , of course, if launch application, works, ...

firstly double check you're using correct package names you've got package listed extension_package add application.receivers definition in manifest. should read following:

<uses-permission android:name="android.permission.receive_boot_completed" /> <application>    <receiver android:enabled="true" android:name="extension_package.applicationstartupreceiver" android:permission="android.permission.receive_boot_completed">     <intent-filter>         <action android:name="android.intent.action.boot_completed" />         <category android:name="android.intent.category.default" />     </intent-filter>    </receiver> </application> 

now when receiver called i'm assuming want start air application? little more complex creating intent actions specifying. android hasn't got way of handling actions calling. need find application entry context , start intent that, below:

if (intent.action_boot_completed.equals(intent.getaction())) {     string componentname = context.getpackagename() + "/.appentry";     intent = new intent( intent.action_main );     i.setcomponent(componentname.unflattenfromstring( componentname ));     i.addcategory( intent.category_launcher );     i.addflags(intent.flag_activity_new_task);     context.startactivity( ); } 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -