procek
procek

Reputation: 121

StatusBarNotification phonegap plugin attach to phonegap project

I'm using Phonegap and I'm looking to use some notification plugins. I found the https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification plugin on GitHub, but I have a problem with compilation in NetBeans. I did everything the instructions say, but its doesn't work. I have error:

Creating output directories if needed...
Compiling aidl files into Java classes...
Compiling RenderScript files into Java classes and RenderScript bytecode...
Generating R.java / Manifest.java from the resources...
compile:
/home/procek/android-sdk-linux_x86/tools/ant/main_rules.xml:384: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 2 source files to /home/procek/NetBeansProjects/myapp/bin/classes
/home/procek/NetBeansProjects/myapp/src/com/phonegap/statusBarNotification/StatusBarNotification.java:44: class StatusBarNotificationPlugin is public, should be declared in a file named StatusBarNotificationPlugin.java
public class StatusBarNotificationPlugin extends Plugin {
/home/procek/NetBeansProjects/myapp/src/com/phonegap/statusBarNotification/StatusBarNotification.java:91: package R does not exist
        int icon = R.drawable.notification;
                    ^
2 errors
/home/procek/android-sdk-linux_x86/tools/ant/main_rules.xml:384: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)

Can you give me some tips? In Android Manifest file I have some risky lines:

    <activity android:name="MainActivity"
              android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="StatusBarNotification"
              android:label="@string/app_name" android:configChanges="orientation|keyboardHidden">
        <intent-filter>
        </intent-filter>
    </activity>

There are double block of activity... But without this I have the same error...

Upvotes: 0

Views: 1632

Answers (1)

yesh
yesh

Reputation: 2070

R.drawable.notification does this image exists in your drawable folder ? please check. I would suggest your to use this file for status bar notification. Follow the instructions in the read me file before your install it. Plugin

create a icon img and name it like icon.png. Place it inside your drawable folder /drawable-hdpi/drawable-idpi. Now when creating the notification you can call it in your systenotification.java as R.drawable.icon . Make sure you go to your system generated java file which will be R.java and check if your have public static final int icon=0x7f020003

Another method is your can simple create public static final int icon=0x7f020002 inside your R.java and call it inside your systemnotification.java. This will draw the image no need to create a image physically. But I would suggest you to go for the 1st option.

Upvotes: 1

Related Questions