0

알림 (안드로이드 알림 영역)의 클릭 이벤트를 얻으려면 계속 노력해야합니다. 실제로 사용자가 알림을 클릭하면 웹 페이지를 열고 싶습니다.알림을 클릭하면 티타늄 - 열린 URL이 표시됩니다.

여기

내 코드는,

var intent = Ti.Android.createIntent({ 
     flags : Ti.Android.FLAG_ACTIVITY_CLEAR_TOP | Ti.Android.FLAG_ACTIVITY_NEW_TASK, 
     data : 'http://www.google.com', 
     //url : 'http://www.google.com', 
     className : 'com.android.browser.BrowserActivity', 
     packageName : 'com.android.browser' 
    }); 
    intent.addCategory(Ti.Android.CATEGORY_LAUNCHER); 

    var pending = Ti.Android.createPendingIntent({ 
     activity : Ti.Android.currentActivity, 
     intent : intent, 
     type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY, 
     flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY 
    }); 
    var dateValue = new Date(); 
    var notification = Ti.Android.createNotification({ 
     contentIntent : pending, 
     contentTitle : Title, 
     contentText : Message, 
     tickerText : Title, 
     when : dateValue.getTime(), 
     icon : Ti.App.Android.R.drawable.appicon, 
     flags : Titanium.Android.ACTION_DEFAULT | Titanium.Android.FLAG_AUTO_CANCEL | Titanium.Android.FLAG_SHOW_LIGHTS, 
     sound : Ti.Filesystem.getResRawDirectory() + 'notification.wav', 
    }); 
    Ti.Android.NotificationManager.notify(1, notification); 
+0

내가 말할 수있는 한 [Titanium에서 사용할 수있는 인 텐트] (http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android.Intent)로 제한되어 있습니다. 안드로이드에 대해 결코 프로그래밍 된 적이 없다면, 앱에 웹뷰를 열거 나 시스템 브라우저를 시작하라는 페이로드로 앱을 여는 인 텐트를 사용해야한다고 생각할 것입니다. – Sukima

+1

[티타늄 - 사용자가 Android 알림을 클릭 할 때 액션 수행] (http://stackoverflow.com/questions/25266834/titanium-perform-action-when-user-clicks-on-android-notification) – Jeroen

답변

1

는 @phil의이 사람은 나를 위해 일한 : https://github.com/foolprooflabs/AndroidNotificationsCustomActivity

그러나 그것은 훨씬 더 안정적이기 때문에 나는 gcm.js로 전환했습니다. http://iamyellow.net/post/40100981563/gcm-appcelerator-titanium-module

+0

나도 마찬가지입니다. iamyellow를 사용하여 알림을 처리 할 것을 권장합니다. –

+0

Thanks buddy :) –

+0

@ van-coding 알림 클릭시 특정 창을 열려고합니다. 첫 번째 제안은 앱이 백그라운드에서 실행될 때만 작동합니다. 앱이 실행되고 있지 않으면 (백그라운드 앱 트레이에서 제거됨) 알림을 클릭하면 앱이 시작 화면에 멈 춥니 다. gcm.js에서 잘 처리되지만 로컬 알림과 함께 사용할 수 있습니까? 로컬 알림을 사용하여 gcm.js 코드를 실행하는 방법을 알고 있습니까? 너의 도움이 정말로 필요해. –

관련 문제