Swarm (social sdk) problem
in
Android Processing
•
1 year ago
Hi all!
I just found a nice android sdk for leaderbords, achievements, in-app shops and cloud data...
http://swarmconnect.com/
Here's the reference (when you are logged in, there's a step by step tutorial.
Howerver it always throws some exeptions.
Here are the first steps of the documentation:
I just found a nice android sdk for leaderbords, achievements, in-app shops and cloud data...
http://swarmconnect.com/
Here's the reference (when you are logged in, there's a step by step tutorial.
Howerver it always throws some exeptions.
Here are the first steps of the documentation:
- Add the following code to your app's AndroidManifest.xml, inside the <application> </application> tags.
<activity android:name="com.swarmconnect.SwarmMainActivity"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateHidden" />
<receiver android:name="com.swarmconnect.SwarmConnectivityReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter> </receiver>
Then I had to add some permissions.
I tried the alternative. Is there a way to extend the main class with processing?
- Extend SwarmActivity
For Swarm to properly respond to requests, all activities in your app must extend SwarmActivity instead of Activity (SwarmActivity extends Activity). Note that the SwarmActivity class behaves the same as the Activity class, but it also does some work for you behind the scenes to manage interactions with Swarm.public class MyActivity extends Activity {
public class MyActivity extends SwarmActivity {
Using another library (such as LibGDX) that doesn't allow you to extend SwarmActivity?
Alternatives to extending SwarmActivity
Swarm just needs to be notified as activities take the foreground (and leave the foreground). This enables Swarm to show notifications like "Achievement Unlocked" and "Item Purchased". Just add the following to each of your activities.public void onCreate(Bundle savedInstanceState) {
-
super.onCreate(savedInstanceState);
-
Swarm.setActive(this);
-
}
-
public void onResume() {
-
super.onResume();
-
Swarm.setActive(this);
-
}
-
public void onPause() {
-
super.onPause();
-
Swarm.setInactive(this);
-
}
- Initialize Swarm
You will need to initialize Swarm at every entry point into your app, typically this is in your main Activity's onCreate() method. Add the following line of code in your main Acitiviy's onCreate() method and replace SWARM_APP_ID and "SWARM_APP_KEY" with your App ID and App Key from the Admin Panel.Swarm.init(this, SWARM_APP_ID, "SWARM_APP_KEY");
This is where my app crashes (when i comment out this init stuff, it compiles).
Any ideas?
The sdk should be rather simle to implement.
greets
- FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lynxgames.drillsergeant/com.swarmconnect.SwarmMainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1872)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1893)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4385)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:901)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:1907)
at android.content.res.Resources.getLayout(Resources.java:740)
at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:250)
at android.app.Activity.setContentView(Activity.java:1742)
at com.swarmconnect.v.b(Unknown Source)
at com.swarmconnect.cc.onCreate(Unknown Source)
at com.swarmconnect.SwarmMainActivity.onCreate(Unknown Source)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1836)
... 11 more
Any ideas?
The sdk should be rather simle to implement.
greets
1