Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Fire event from Android Action

$
0
0

I am currently working on an Android module for the PushIO notification service.

The push notification is appearing on the phone, and I have been able to create and activity for the NOTIFICATIONPRESSED action. Within the action I want to fire an event that I can then listen to in my app.

However when the evnt is fired I get the following error.

W/V8Object( 2225): (KrollRuntimeThread) [8,16109] Runtime initialized, cannot fire event 'PushIO_Callback'
Any suggestions on where I am going wrong?

Thanks

Will

Titanium Studio, build: 3.4.1.201410281727 Android SDK 4.4.4

timodule.xml

<activity android:name="uk.co.tbp.pushio.PushIOPressedActivity"  android:exported="true" >
  <intent-filter>
    <action android:name="${tiapp.properties['id']}.NOTIFICATIONPRESSED"/>
    <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
</activity>
PushIOPressedActivity.java
public class PushIOPressedActivity extends Activity {
 
    public void onCreate(Bundle intent) {
        super.onCreate(intent);
        Log.d(LCAT, "******* onCreate ********");
        Log.d(LCAT, "KrollRuntime.isInitialized() => "+KrollRuntime.isInitialized());
 
        PushIoModule.handleEvent(PushIoModule.CALLBACK_EVENT, getPushData(getIntent()));
    }
PushIoModule.java
public static PushIoModule getModule() {
  TiApplication appContext = TiApplication.getInstance();
  PushIoModule module = (PushIoModule) appContext.getModuleByName(MODULE_NAME);
  if (module == null) {
    Log.w(LCAT,"PUSHIO module not currently loaded");
  }
 
  return module;
}
 
 
public static void handleEvent(String type, Map<String,String> data) {
    Log.d(LCAT,"handleEvent");
    PushIoModule uaModule = getModule();
    if (uaModule != null) {
      uaModule.fireEvent(type, data);
    }
}

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>