Could somebody explain the syntax of the ipdialplan.xml, and how to modify it.
I've got the problem, that I can't use my contacts when my phone (Artemis)
is in SIP Mode. My numbers are stored in following format, e.g. for Germany, Hamburg: +49(40)1234567. I've to enter the number manually as 0049401234567 or 040123456 without '+' or '()'.
..........
ipdialplan.xml creating and managing
Dial Plan Regular Expression Engine - Language Summary,
see : http://msdn2.microsoft.com/en-us/library/aa921921.aspx
DialPlan Component ,
see : http://msdn2.microsoft.com/en-us/library/aa921954.aspx
Nice to test your regular expression, if you need to create new one,
see : http://www.roblocher.com/technotes/regexp.aspx
Very important to know : the last matched rule is the selected one, so be careful if a rule can match more than one pattern. It has to be first.
Here is my ipdialplan.xml
Notice :
- With Swiss rule you don't need to dial 00 + international code before the number you want. At least, you have to change 41 by your international code
- Internation rule should be good for anybody beginning his number with 00 (00 41 (12) 345 67 89) or with + (+41 12 345 67 89)
<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<!-- IP address rules -->
<rule pattern='\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
restrict='Cell,SMS'
/>
<rule pattern='(\d{1,3})\*(\d{1,3})\*(\d{1,3})\*(\d{1,3})'
dial='\1.\2.\3.\4'
display='\1.\2.\3.\4'
transfer='\1.\2.\3.\4'
restrict='Cell,SMS'
/>
<!-- SIP URI rules -->
<rule pattern='[Ss][Ii][Pp][Ss]?:\s*(\d{3})(\d{3})(\d{4})@(.+)'
display='(\1) \2-\3'
restrict='Cell,SMS'
/>
<rule pattern='([Ss][Ii][Pp][Ss]??\s*([a-zA-Z0-9_-]+)@(.+)'
display='\2'
restrict='Cell,SMS'
/>
<rule pattern='[Ss][Ii][Pp][Ss]?:\s*([^@]+)'
display='\1'
restrict='Cell,SMS'
/>
<!-- As the last matched rule is the selected one, Swiss rule has to be first, as it matches also 00...
numbers -->
<!-- Swiss rule -->
<rule pattern='0([1-9])(\d{8})'
dial='sip:0041\1\[email protected]$host$'
display='0\1\2'
transfer='sip:0041\1\[email protected]$host$'
/>
<!-- International rules -->
<rule pattern='\+\D*(\d+)\D*(\d+)\D*(\d*)\D*(\d*)\D*(\d*)\D*(\d*)'
dial='sip:00\1\2\3\4\5\[email protected]$host$'
display='+\1\2\3\4\5\6'
transfer='sip:00\1\2\3\4\5\[email protected]$host$'
/>
<rule pattern='(0{2})\D*(\d+)\D*(\d+)\D*(\d*)\D*(\d*)\D*(\d*)\D*(\d*)'
dial='sip:\1\2\3\4\5\6\[email protected]$host$'
display='\1\2\3\4\5\6\7'
transfer='sip:\1\2\3\4\5\6\[email protected]$host$'
/>
</dialplan>
I'm having a hard time with the syntax as well. I am able to receive voip calls but get an error when making them. I'm sure it has to do with the ipdialplan.xml.
I need for numbers I dial to be passed to SIP directly..ie 17025551212 will dial 17025551212 without changing it. Also it would be nice to have the + translated to 011 for SIP dialing...
Here is my current file, any help would be greatly appreciated.
Code:
<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<!-- IP address rules -->
<rule pattern='\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
restrict='SMS'
/>
<rule pattern='(\d{1,3})\*(\d{1,3})\*(\d{1,3})\*(\d{1,3})'
dial='\1.\2.\3.\4'
display='\1.\2.\3.\4'
transfer='\1.\2.\3.\4'
restrict='SMS'
/>
<!-- 11-digits rules -->
<rule pattern='1\s*-?\s*(\d{3})\s*(\d{3})\s*-?\s*(\d{4})(\s*[Xx]\s*\d+)?'
dial='sip:\1\2\[email protected]$host$'
display='(\1) \2-\3'
transfer='sip:1\1\2\[email protected]$host$'
/>
<rule pattern='1\s*-?\s*\((\d{3})\)\s*(\d{3})\s*-?\s*(\d{4})(\s*[Xx]\s*\d+)?'
dial='sip:\1\2\[email protected]$host$'
display='(\1) \2-\3'
transfer='sip:1\1\2\[email protected]$host$'
/>
<rule pattern='\+\s*1\s*-?\s*(\d{3})\s*(\d{3})\s*-?\s*(\d{4})(\s*[Xx]\s*\d+)?'
dial='sip:\1\2\[email protected]$host$'
display='(\1) \2-\3'
transfer='sip:1\1\2\[email protected]$host$'
/>
<rule pattern='\+\s*1\s*-?\s*\((\d{3})\)\s*(\d{3})\s*-?\s*(\d{4})(\s*[Xx]\s*\d+)?'
dial='sip:\1\2\[email protected]$host$'
display='(\1) \2-\3'
transfer='sip:1\1\2\[email protected]$host$'
/>
<!-- 10-digits rules -->
<rule pattern='(\d{3})\s*(\d{3})\s*-?\s*(\d{4})(\s*[Xx]\s*\d+)?'
dial='sip:\1\2\[email protected]$host$'
display='(\1) \2-\3'
transfer='sip:\1\2\[email protected]$host$'
/>
<rule pattern='\((\d{3})\)\s*(\d{3})\s*-?\s*(\d{4})(\s*[Xx]\s*\d+)?'
dial='sip:\1\2\[email protected]$host$'
display='(\1) \2-\3'
transfer='sip:\1\2\[email protected]$host$'
/>
<!-- 7-digits rules -->
<rule pattern='(\d{3})\s*-?\s*(\d{4})'
dial='sip:262\1\[email protected]$host$'
display='\1-\2'
transfer='sip:262\1\[email protected]$host$'
/>
<!-- SIP URI rules -->
<rule pattern='[Ss][Ii][Pp][Ss]?:\s*(\d{3})(\d{3})(\d{4})@(.+)'
display='(\1) \2-\3'
restrict='SMS'
/>
<rule pattern='([Ss][Ii][Pp][Ss]?:)?\s*([a-zA-Z0-9_-]+)@(.+)'
display='\2'
restrict='SMS'
/>
<rule pattern='[Ss][Ii][Pp][Ss]?:\s*([^@]+)'
display='\1'
restrict='SMS'
/>
<!-- 5-digits rules -->
<rule pattern='(\d{3})-?(\d{2})'
dial='sip:\1\[email protected]$host$'
display='\1\2'
transfer='sip:\1\[email protected]$host$'
/>
<rule pattern='1\s*\((\d{3})\)\s*(\d)'
dial='sip:1\1\[email protected]$host$'
display='1\1\2'
transfer='sip:1\1\[email protected]$host$'
/>
<!-- Only digits -->
<rule pattern='(\d+)'
dial='sip:\[email protected]$host$'
display='\1'
transfer='sip:\[email protected]$host$'
/>
</dialplan>
is it possible through dial plain to remove +39 prefix from the number dialed and replace it with 0?
All my contacts are like this
+39 02 7458412
and it should became
0 02 7458412
Is it possible?
Remove +39 (or any) prefix
alex_time said:
is it possible through dial plain to remove +39 prefix from the number dialed and replace it with 0?
All my contacts are like this
+39 02 7458412
and it should became
0 02 7458412
Is it possible?
Click to expand...
Click to collapse
As you have spaces between numbers' group, this rule will fit your need :
<rule pattern='\+\D*(\d+)\D*(\d+)\D*(\d*)\D*(\d*)\D*(\d* )\D*(\d*)'
dial='sip:0\2\3\4\5\[email protected]$host$'
display='0\2\3\4\5\6'
transfer='sip:0\2\3\4\5\[email protected]$host$'
/>
To pass dialed number directly to SIP
Jayman007 said:
I'm having a hard time with the syntax as well. I am able to receive voip calls but get an error when making them. I'm sure it has to do with the ipdialplan.xml.
Click to expand...
Click to collapse
Unfortunately, yes...
I need for numbers I dial to be passed to SIP directly..ie 17025551212 will dial 17025551212 without changing it.
Click to expand...
Click to collapse
So you have to make your ipdialplan.xml simpler. This one will be enough (only if you don't have space or non-digit):
<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<rule pattern='(\d*)'
dial='sip:\[email protected]$host$'
display='\1'
transfer='sip:\[email protected]$host$'
/>
</dialplan>
Also it would be nice to have the + translated to 011 for SIP dialing...
Click to expand...
Click to collapse
Troubles are beginning...
Each way to dial a number as to be fitted by a specific rule (examples: if you want to use spaces, or dots, or parenthesis...)
If your numbers have to be passed directly, except if they have the +, you should try :
<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<rule pattern='(\d*)'
dial='sip:\[email protected]$host$'
display='\1'
transfer='sip:\[email protected]$host$'
/>
<rule pattern='\+(\d*)'
dial='sip:011\[email protected]$host$'
display='011 \1'
transfer='sip:011\[email protected]$host$'
/>
</dialplan>
chrcha said:
As you have spaces between numbers' group, this rule will fit your need :
<rule pattern='\+\D*(\d+)\D*(\d+)\D*(\d*)\D*(\d*)\D*(\d* )\D*(\d*)'
dial='sip:0\2\3\4\5\[email protected]$host$'
display='0\2\3\4\5\6'
transfer='sip:0\2\3\4\5\[email protected]$host$'
/>
Click to expand...
Click to collapse
Thank, I will try
chrcha said:
Unfortunately, yes...
So you have to make your ipdialplan.xml simpler. This one will be enough (only if you don't have space or non-digit):
<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<rule pattern='(\d*)'
dial='sip:\[email protected]$host$'
display='\1'
transfer='sip:\[email protected]$host$'
/>
</dialplan>
Troubles are beginning...
Each way to dial a number as to be fitted by a specific rule (examples: if you want to use spaces, or dots, or parenthesis...)
If your numbers have to be passed directly, except if they have the +, you should try :
<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<rule pattern='(\d*)'
dial='sip:\[email protected]$host$'
display='\1'
transfer='sip:\[email protected]$host$'
/>
<rule pattern='\+(\d*)'
dial='sip:011\[email protected]$host$'
display='011 \1'
transfer='sip:011\[email protected]$host$'
/>
</dialplan>
Click to expand...
Click to collapse
I tried the above configs but still cannot place a call. Not sure why but keep getting network unavailable message when I dial.
Hopefully one day I will figure this out and be able to place calls via VOIP on my phone.
Is there any possibility to dial Jabber contacts? I.e. to call [email protected] from WM6?
I will give $30 by PayPal to anyone who can create a Dial Plan Wizard app for the WM6 devices including the Kaiser, which allows you to specify in simple fields what to dial when, and also crucially to ignore text characters after a number (e.g. +44 20 7841 1234 - Sales).
Anyone care to join me and start a fund to get such an app created? Please reply at the specific thread for this idea here: http://forum.xda-developers.com/showthread.php?p=1769969#post1769969
Trying to develop a dialplan, I found that my HTC TyTN as well as my HP ipaq 514 deletes blanks (spaces) from a phonebook entry before it is subjected to the dialplan ruling. That means that any spaces cannot be used to identify a rule. i.e. 0031 20 ... cannot be caught by requiring a space between the country code and the rest of the number.
Anyone aware of this an/or any registry setting that prevents this blank deletion? It a kind of degrades the power of dialing rules.
I tested this with the following dialplan, after not understanding why a certain rule did not catch a number on my iPAQ514.
So a phonebook entry of 0031 20 123 4567 will display 0031201234567 through the following dialplan that only catches all characters
Code:
<wap-provisioningdoc>
<characteristic type="VoIP">
<parm name="DialPlan"
value="<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<!-- IP address rules -->
<!-- all characters -->
<rule pattern='(.*)'
dial='sip:\[email protected]$host$'
display='todial:\1'
transfer='sip:\[email protected]$host$'
/>
</dialplan> " />
</characteristic>
</wap-provisioningdoc>
chrcha said:
Dial Plan Regular Expression Engine - Language Summary,
see : http://msdn2.microsoft.com/en-us/library/aa921921.aspx
DialPlan Component ,
see : http://msdn2.microsoft.com/en-us/library/aa921954.aspx
Nice to test your regular expression, if you need to create new one,
see : http://www.roblocher.com/technotes/regexp.aspx
Very important to know : the last matched rule is the selected one, so be careful if a rule can match more than one pattern. It has to be first.
[............]
</dialplan>
Click to expand...
Click to collapse
Thanks, that testing site is very handy. About the first/last issue: Though read everywhere I found that WM6 takes the first match, not the last match. I tested that with the following plan. Try a 00 number and it dispalys First:number.
Code:
<wap-provisioningdoc>
<characteristic type="VoIP">
<parm name="DialPlan"
value="<dialplan xmlns='http://schemas.microsoft.com/embedded/VoIP'>
<dialplan-header>
<host>#use_sipsrv_host_name#</host>
</dialplan-header>
<!-- Dial Plan rules -->
<!-- IP address rules -->
<!-- Only digits -->
<rule pattern='00(.*)'
dial='sip:00\[email protected]$host$'
display='FIRST: 00\1'
transfer='sip:00\[email protected]$host$'
/>
<rule pattern='00(.*)'
dial='sip:00\[email protected]$host$'
display='2ND:00\1'
transfer='sip:00\[email protected]$host$'
/>
<rule pattern='(.*)'
dial='sip:\[email protected]$host$'
display='todial:\1'
transfer='sip:\[email protected]$host$'
/>
</dialplan> " />
</characteristic>
</wap-provisioningdoc>
dick99999 said:
... About the first/last issue: Though read everywhere I found that WM6 takes the first match, not the last match. I tested that with the following plan. Try a 00 number and it dispalys First:number.
Click to expand...
Click to collapse
I red the same. But on my HTC Touch with WM6 it takes the last one. I don't know why.
Concretley, it means that the order of the rules is very important, as the parsing looks for your pattern ANYWHERE in the string. It means that more than one rule can match your string.
dick99999 said:
Trying to develop a dialplan, I found that my HTC TyTN as well as my HP ipaq 514 deletes blanks (spaces) from a phonebook entry before it is subjected to the dialplan ruling. That means that any spaces cannot be used to identify a rule. i.e. 0031 20 ... cannot be caught by requiring a space between the country code and the rest of the number.
Anyone aware of this an/or any registry setting that prevents this blank deletion? It a kind of degrades the power of dialing rules.
Click to expand...
Click to collapse
In a rule :
<rule pattern= ...
dial= ...
display= ...
transfer= ...
/>
what is diplayed is not what is dialed...
So you can keep on your display the spaces (as display= ... is used to format of the string to be displayed to the user) and remove them from the URI (as dial= ... format the string into a URI which will be sent in the SIP INVITE)
(cf. http://msdn2.microsoft.com/en-us/library/aa921954.aspx)
CJSnet said:
I will give $30 by PayPal to anyone who can create a Dial Plan Wizard app for the WM6 devices including the Kaiser, which allows you to specify in simple fields what to dial when, and also crucially to ignore text characters after a number (e.g. +44 20 7841 1234 - Sales).
Click to expand...
Click to collapse
I'm not able to do a Dial Plan Wizard app but :
My country code is +44
My prefix for international calls is 00
My prefix for national calls is 0
From that it should be able to translate the following sort of numbers for dialling out via VoIP using the dialplan file:
+44 20 1234 5678 becomes 020 1234 5678
020 1234 5678 remains 020 1234 5678
+1 404 123 4567 becomes 001 404 123 4567
"+1 404 123 4567 - Sales" becomes 001 404 123 4567
1471 remains 1471
Click to expand...
Click to collapse
shouldn't be to complicated to put in an ipdialplan.xml, except :
And so on...
Click to expand...
Click to collapse
Try this attachment.
PS For me, it's what I did in my ipdialplan, +44 20 1234 5678 remains, but 020 1234 5678 become +44 20 1234 5678
Sorry...
I made correct the attachment of the previous post. This attachment is now for swiss rule plan dialing.
chrcha said:
In a rule :
<rule pattern= ...
dial= ...
display= ...
transfer= ...
/>
what is diplayed is not what is dialed...
So you can keep on your display the spaces (as display= ... is used to format of the string to be displayed to the user) and remove them from the URI (as dial= ... format the string into a URI which will be sent in the SIP INVITE)
(cf. http://msdn2.microsoft.com/en-us/library/aa921954.aspx)
Click to expand...
Click to collapse
Sorry, i did not clarify my point. My remark is not about output ( the dial, diaplay etc). My remark is about INPUT. So the string of the number to parse that stems from the phone book entry, does not contain blanks (spaces). It seesm to be pre parsed, also called normalized.
As a consequence, in one's own dialplan rules that determine which output to generate, one can thus not rely on spaces that exist in the phonebook entry, and let those spaces also determine the dial plan rule.
As an example if the phonebook entry is +31{space}201234567 or it is +3120123{space}4567, those listings generate the same to parse input string for the dialplan. One can thus not determine what the country code is from relying on spaces separating the country code. Another example is for local numbers (after the area code) of 7 or 8 digit numbers like 123{space}4567 and 1234{space}5678
dick99999 said:
... As a consequence, in one's own dialplan rules that determine which output to generate, one can thus not rely on spaces that exist in the phonebook entry, and let those spaces also determine the dial plan rule.
Click to expand...
Click to collapse
You're right. In fact, you cannot even rely on any non digit character!
That's why, it's very complicated to make a dialplan functionning worldwide, when you use non digit characters to make more readable your phonebook entry.
When you don't use non digit character, it's simple: you simply send the string in the SIP INVITE.
Those who are using only this three type of phone entries (with or without any non digit characters inside the number):
- a number beginning with only one 0 (zero) = area code + local number -> in that case, you add the international code (+xx) and suppress the 0 before using it.
- a number beginning with 00 (2 zero) = international number -> in that case, the phone number can be used as it is.
- a number beginning with + = international number -> in that case, you change the + by 00 before using it.
have a very simple ipdialplan and it's simple to make a Dial Plan Wizard app (as you only have to adjust the ipdialplan with your international prefix for numbers beginning with only one 0).
Dialplan for Pennytel or Australia
hi, if anyone of you could help me make a dialplan that would be awesome
my phonebook entry is in (07) xxxx xxxx for local and mobile is (04) xxxx xxxx which are essentially the same
these need to be passed to the VOIP as it is 07xxxxxxxx or 04xxxxxxxx
then my phonebook for international to taiwan is +886 xxx xxxx these needed to be passed as 0011 886 xxx xxxx
does anyone know how to do that? it would be so good if anyone could help
i would post these onto the australian forums to make it easier for everyone here.
thank you all!
Hi to all,
I developed an application for android and i published it on the Market. The app support small, normal and large screen and has few requirements.
In particular it uses camera, internet, gps; from the developer console here are requirements:
Code:
Localized to: default
Permissions: android.permission.INTERNET, android.permission.ACCESS_FINE_LOCATION, android.permission.CAMERA, android.permission.ACCESS_NETWORK_STATE
Features: android.hardware.camera, android.hardware.location, android.hardware.location.gps, android.hardware.camera.autofocus, android.hardware.touchscreen
API level: 7-12+
Supported screens: small-large
OpenGL textures: all
My problem is that the app is not instaling on the Samsung Galaxy Next (s5570); from this phone the app is not found in the market, and installing the app with a manual apk it says that it is not supported due to manifest specification.
Here is my manifest piece with permissions:
Code:
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true" />
It seems that this kind of phone has all the requirements, so has anyone experienced the same problem? If yes did you found a solution?
Thank you in advance.
In this post I will be explaining you guys that 'How to make a push notification app through GCM Service on PushBots'
Code is necessary for the implementation can be copied from here and watch the video below for the detail explanation of the implementation. Video will be uploaded soon
Android SDK integration
go to your module build.gradle file add PushBots dependency along with android support library v4:
Step 1: Import the Pushbots library into your project:
Code:
compile 'com.pushbots:pushbots-lib:[email protected]'
compile 'com.android.support:support-v4:21.0.0'
Re-build your project and wait for gradle to finish.
Step 2: Update AndroidManifest.xml file:
Add the following permessions and change com.example.sampleapp with your app identifier.
Code:
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="com.example.sampleapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.example.sampleapp.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive dataf message. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
The following intent-filter in your main activity:
Code:
<intent-filter>
<action android:name="com.example.sampleapp.MESSAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Add the following activity, reciever and service before the end of your application tag, and in all of the above code change com.example.sampleapp with your app identifier.
Code:
<receiver
android:name="com.pushbots.google.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.sampleapp" />
</intent-filter>
</receiver>
<receiver android:name="com.pushbots.push.DefaultPushHandler" />
<service android:name="com.pushbots.push.GCMIntentService" />
Step 3: Creating pushbots.xml config file:
Go to Res folder -> Values --> Right click and new Resource File and name it pushbots with this content. Change your app ID and Sender ID.
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Pushbots Application ID -->
<string name="pb_appid">548ef5901d0ab1</string>
<!-- GCM Sender ID -->
<string name="pb_senderid">48849973</string>
<!-- Pushbots Log Level log Tag "PB2" -->
<string name="pb_logLevel">DEBUG</string>
</resources>
Step 4: Add required code:
in your main Activity add this line:
Code:
Pushbots.sharedInstance().init(this);
That's pretty much it. Run your application now, if all goes well, your device should be registered and ready to recieve push notifications.
Step 5: Custom handler for notifications (Optional):
5.1. Create customHandler class.
Code:
public class customHandler extends BroadcastReceiver
{
private static final String TAG = "customHandler";
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
Log.d(TAG, "action=" + action);
// Handle Push Message when opened
if (action.equals(PBConstants.EVENT_MSG_OPEN)) {
//Check for Pushbots Instance
Pushbots pushInstance = Pushbots.sharedInstance();
if(!pushInstance.isInitialized()){
Log.d("Initializing Pushbots.");
Pushbots.sharedInstance().init(context.getApplicationContext());
}
//Clear Notification array
if(PBNotificationIntent.notificationsArray != null){
PBNotificationIntent.notificationsArray = null;
}
HashMap<?, ?> PushdataOpen = (HashMap<?, ?>) intent.getExtras().get(PBConstants.EVENT_MSG_OPEN);
Log.w(TAG, "User clicked notification with Message: " + PushdataOpen.get("message"));
//Report Opened Push Notification to Pushbots
if(Pushbots.sharedInstance().isAnalyticsEnabled()){
Pushbots.sharedInstance().reportPushOpened( (String) PushdataOpen.get("PUSHANALYTICS"));
}
//Start lanuch Activity
String packageName = context.getPackageName();
Intent resultIntent = new Intent(context.getPackageManager().getLaunchIntentForPackage(packageName));
resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_CLEAR_TASK);
resultIntent.putExtras(intent.getBundleExtra("pushData"));
Pushbots.sharedInstance().startActivity(resultIntent);
// Handle Push Message when received
}else if(action.equals(PBConstants.EVENT_MSG_RECEIVE)){
HashMap<?, ?> PushdataOpen = (HashMap<?, ?>) intent.getExtras().get(PBConstants.EVENT_MSG_RECEIVE);
Log.w(TAG, "User Received notification with Message: " + PushdataOpen.get("message"));
}
}
}
5.2. Open AndroidManifest.xml and replace DefaultPushHandler with your custom Handler class.
Code:
<receiver android:name="PACKAGE_NAME.customHandler" />
5.3. Set your customHandler class in MainActivity.
Code:
Pushbots.sharedInstance().setCustomHandler(customHandler.class);
Pls hit the thanks button if i helped you :angel:
For more information-Visit: http://androidtechfreakat.blogspot.in
http://androidtechxdaat,weebly.com
http://advaitt17.github.io
XDA:DevDB Information
[GUIDE]To make a Push Notificaton App via GCM Service by AdvaitT17, App for all devices (see above for details)
Contributors
AdvaitT17, PushBots Developers
Source Code: www.pushbots.com
Version Information
Status: Stable
Created 2016-04-06
Last Updated 2016-05-20
Reserved
If there are any doubts about this process yoi can PM me on Xda