Added setting to run tutorials directly from the app + updated README

This commit is contained in:
Sylvain Berfini 2013-01-16 16:32:56 +01:00
parent 2ae6bd699e
commit 7c6f4c78bf
6 changed files with 143 additions and 6 deletions

View file

@ -123,6 +123,41 @@
<service android:name="org.linphone.gcm.GCMService" /> <service android:name="org.linphone.gcm.GCMService" />
<activity android:name="org.linphone.tutorials.TutorialLauncherActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialBuddyStatusActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialChatRoomActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialHelloWorldActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity android:name="org.linphone.tutorials.TutorialRegistrationActivity"
android:theme="@style/NoTitle">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application> </application>
</manifest> </manifest>

14
README
View file

@ -4,13 +4,18 @@
To build liblinphone for Android, you must: To build liblinphone for Android, you must:
0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path. 0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path.
1) download the Android ndk (>=r8b) from google and add it to your path. 1) download the Android ndk (>=r8b) from google and add it to your path.
2) install the autotools: autoconf, automake, aclocal, libtoolize pkgconfig 2) install the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig
2bis) on some 64 bits systems you'll need the ia32-libs package 2bis) on some 64 bits systems you'll need the ia32-libs package
3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project. 3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project.
$ make $ make
4) To install the generated apk into a plugged device, run 4) To install the generated apk into a plugged device, run
$ make install $ make install
To run the tutorials:
1) open the res/values/non_localizable_custom.xml file and change the value of the show_tutorials_instead_of_app to true.
2) compile again using make && make install.
3) /!\ don't forget to put it back to false to run the linphone application normally. /!\
To create an apk with a different package name, you need to edit the custom_rules.xml file: To create an apk with a different package name, you need to edit the custom_rules.xml file:
1) look for the property named "linphone.package.name" and change it value accordingly 1) look for the property named "linphone.package.name" and change it value accordingly
2) run again the Makefile script by calling "make" 2) run again the Makefile script by calling "make"
@ -20,11 +25,12 @@ Some options can be passed to make, like "make SOME_OPTION=SOME_VALUE".
Option Name | Possible values | Default value Option Name | Possible values | Default value
------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------
BUILD_X264 0 (don't build x264) or 1 (build x264) | 0 BUILD_X264 0 (don't build x264) or 1 (build x264) | 0
BUILD_AMRNB 0 (don't build amrnb codec), light (try to use amrnb codec from android), full (build your own amrnb codec) | light BUILD_AMRNB 0 (don't build amrnb codec), light (try to use amrnb codec from android), full (build your own amrnb codec) | full
BUILD_AMRWB 0 (don't build amrwb codec), 1 (build your own amrwb codec) | 1 BUILD_AMRWB 0 (don't build amrwb codec), 1 (build your own amrwb codec) | 0
BUILD_GPLV3_ZRTP 0 (don't support ZRTP), 1 (support ZRTP and make the whole program GPLv3) | 0 BUILD_GPLV3_ZRTP 0 (don't support ZRTP), 1 (support ZRTP and make the whole program GPLv3) | 0
BUILD_SILK 0 (don't build silk plugin), 1 (build silk) [silk is Skype nonfree patented audio codec] | 0 BUILD_SILK 0 (don't build silk plugin), 1 (build silk) [silk is Skype nonfree patented audio codec] | 1
BUILD_G729 0 (don't build g729 plugin), 1 (build g729) [g729 is nonfree patented audio codec, contact Sipro lab for more details] | 0 BUILD_G729 0 (don't build g729 plugin), 1 (build g729) [g729 is nonfree patented audio codec, contact Sipro lab for more details] | 0
BUILD_TUNNEL 0 (don't build tunnel), 1 (build tunnel) [requires a tunnel implementation in submodules/linphone/tunnel] | 0 BUILD_TUNNEL 0 (don't build tunnel), 1 (build tunnel) [requires a tunnel implementation in submodules/linphone/tunnel] | 0
BUILD_WEBRTC_AECM 0 (don't build echo canceler), 1 (build echo canceler) | 1 BUILD_WEBRTC_AECM 0 (don't build echo canceler), 1 (build echo canceler) | 1
USE_JAVAH 0 (don't generate header), 1 (generate header for linphone_core_jni) [used to check errors at liblinphone compilation] | 1 USE_JAVAH 0 (don't generate header), 1 (generate header for linphone_core_jni) [used to check errors at liblinphone compilation] | 1
BUILD_FOR_X86 0 (don't generate liblinphone libraries for x86 architecture), 1 (build liblinphone libraries for x86 architecture) | 1

33
res/layout/tutorials.xml Normal file
View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center"
android:orientation="vertical">
<Button android:text="Hello world tutorial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="startHelloWorldTutorial" />
<Button android:text="Registration tutorial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="startRegistrationTutorial" />
<Button android:text="Chat room tutorial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="startChatRoomTutorial" />
<Button android:text="Buddy status tutorial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="startBuddyStatusTutorial" />
</LinearLayout>

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Tutorial settings -->
<bool name="show_tutorials_instead_of_app">false</bool> <!-- Be careful ! Setting this to true prevent the app from working ! It will only display tutorial activities -->
<!-- Push notification settings --> <!-- Push notification settings -->
<bool name="enable_push_id">true</bool> <bool name="enable_push_id">true</bool>
<string name="push_sender_id">622464153529</string> <string name="push_sender_id">622464153529</string>

View file

@ -22,6 +22,7 @@ import static android.content.Intent.ACTION_MAIN;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.tutorials.TutorialLauncherActivity;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
@ -74,12 +75,18 @@ public class LinphoneLauncherActivity extends Activity {
} }
protected void onServiceReady() { protected void onServiceReady() {
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(LinphoneActivity.class); final Class<? extends Activity> classToStart;
if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) {
classToStart = TutorialLauncherActivity.class;
} else {
classToStart = LinphoneActivity.class;
}
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(classToStart);
mHandler.postDelayed(new Runnable() { mHandler.postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {
startActivity(new Intent().setClass(LinphoneLauncherActivity.this, LinphoneActivity.class).setData(getIntent().getData())); startActivity(new Intent().setClass(LinphoneLauncherActivity.this, classToStart).setData(getIntent().getData()));
finish(); finish();
} }
}, 1000); }, 1000);

View file

@ -0,0 +1,53 @@
package org.linphone.tutorials;
/*
TutorialLauncherActivity.java
Copyright (C) 2013 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import org.linphone.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
/**
* @author Sylvain Berfini
*/
public class TutorialLauncherActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tutorials);
}
public void startHelloWorldTutorial(View v) {
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialHelloWorldActivity.class));
}
public void startRegistrationTutorial(View v) {
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialRegistrationActivity.class));
}
public void startChatRoomTutorial(View v) {
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialChatRoomActivity.class));
}
public void startBuddyStatusTutorial(View v) {
startActivity(new Intent().setClass(TutorialLauncherActivity.this, TutorialBuddyStatusActivity.class));
}
}